import java.io.*;
import java.util.*;
import javax.microedition.lcdui.Display;

public final class ce
{

    public static int a = 200;
    public static cc b = new cc(a);
    public static int c;
    public static int d;
    public static int e;
    public static int f;
    public static String g;
    private static final int i[] = new int[91];
    private static final int j[] = new int[8];
    private static final Calendar k;
    private static final Date l = new Date();
    private static final StringBuffer m = new StringBuffer(200);
    private static final Class n = new ce().getClass();
    private static final Hashtable o = new Hashtable();
    public static String h = System.getProperty("microedition.locale");

    static {
        k = Calendar.getInstance();
        InputStream in = null;
        DataInputStream din = null;
        try {
            in = n.getResourceAsStream("/sin");
            din = new DataInputStream(in);
            e = din.readUnsignedShort();
            for (int j = 1; j < 90; j++) {
                i[j] = din.readUnsignedShort();
            }
            i[90] = e;
        } catch (Exception ex) {
            a("/sin", ex);
        } finally {
            if (din != null) {
                try {
                    din.close();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
            din = null;
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
            in = null;
        }
    }

    private ce()
    {
    }

    public static void a(Display display)
    {
        String s;
        c = display.numAlphaLevels();
        if((s = System.getProperty("microedition.platform")) == null)
            s = "j2me";
        a(1, s.equals("j2me"));
        b(s);
        if ("j2me".equals(s) && c == 4) { //goto _L2; else goto _L1
//_L1:
        a(9,true);
//        true;
//          goto _L3
        }else{
//_L2:
        a(9,System.getProperty("CellID") != null);
        }
//_L3:
//        a();
        if(s.equals("j2me/applet")){// goto _L5; else goto _L4
//_L4:
        a(1, true);
        a(2,true);
//          goto _L6
        }else
        if(s.equals("j2me/emulator")){// goto _L8; else goto _L7
                a(1,true);
        }
//_L8:
        a(3, s.startsWith("Nokia"));
        if(s.startsWith("NokiaE-90") || s.startsWith("NokiaE90"))
        {
            a(24, true);
            a(26, true);
            d = 2;
        }
        if(s.startsWith("NokiaN95"))
            a(28, true);
        if(s.startsWith("NokiaE61i"))
        {
            a(27, true);
            a(26, true);
            d = 2;
        }
        if(s.startsWith("Nokia9500") || s.startsWith("Nokia9300") || a(24))
            a(11, true);
        if(s.startsWith("NokiaN80") || s.startsWith("NokiaN90") || s.startsWith("NokiaE60") || s.startsWith("NokiaE70") || s.startsWith("NokiaN73") || a(24))
            a(22, true);
        if(s.startsWith("NokiaN80") || s.startsWith("NokiaN93") || s.startsWith("NokiaN71") || s.startsWith("NokiaN73") || s.startsWith("NokiaE70"))
            d = 4;
        if(s.startsWith("Nokia3250") || s.startsWith("NokiaN70"))
            d = 2;
        if(s.startsWith("SonyEricssonW550i"))
            a(16, true);
        if(s.startsWith("SonyEricsson"))
        {
            a(17, true);
            a(10, true);
        }
        if(s.startsWith("intent JTE"))
            a(18, true);
        if(s.startsWith("Nokia7710"))
        {
            a(19, true);
            a(11, true);
        }
        if(s.startsWith("CX65") || s.startsWith("SIE-EL") || s.startsWith("BENQ-EF"))
            a(20, true);
        if(s.startsWith("RIM Wireless"))
            a(21, true);
        a(12, s.startsWith("Nokia6600") || s.startsWith("Nokia7610") || s.startsWith("NokiaN95"));
        a(25, s.startsWith("Nokia6600") || s.startsWith("Nokia7610"));
        a(23, s.startsWith("VS") || s.startsWith("SA") || s.startsWith("MX"));
        if(a(9))
            a(10, true);
        String s1 = aq.a().b("china-proxy");
        a(29, s1 != null && s1.trim().equals("true"));
        try
        {
            Class.forName("widsets.S40DisplayState");
            a(30, true);
            a("S40Back true");
        }
        catch(Throwable _ex)
        {
            a(30, false);
            a("S40Back false");
        }
        try
        {
            Class.forName("widsets.ui.S40ActiveStandby");
            a(31, true);
            a("S40Active true");
        }
        catch(Throwable _ex)
        {
            a(31, false);
            a("S40Active false");
        }
        b("locale " + h);
        g = s;
    }

    private static void a(int i1, boolean flag)
    {
        if(flag){// goto _L2; else goto _L1
//_L1:
        j[i1 / 32] |= 1 << i1 % 32;
//        JVM INSTR ior ;
//          goto _L3
        }else{
//_L2:
        j[i1 / 32] &= ~(1 << i1 % 32);
//        JVM INSTR iand ;
        }
//_L3:
//        JVM INSTR iastore ;
    }

    public static boolean a(int i1)
    {
        return (j[i1 / 32] & 1 << i1 % 32) != 0;
    }

    public static void b(int i1)
    {
        if(a(24))
            a(11, i1 == 800);
        if(a(28))
            a(11, i1 == 320);
    }

    public static final void a(String s)
    {
        g(s);
    }

    public static final void b(String s)
    {
        g(s);
    }

    public static final void c(String s)
    {
        g(s);
    }

    public static final void a(String s, Throwable throwable)
    {
        g(s + ":" + throwable);
        throwable.printStackTrace();
    }

    private static final synchronized void g(String s)
    {
        StringBuffer stringbuffer = m;
        stringbuffer.setLength(0);
        Calendar calendar = k;
        l.setTime(System.currentTimeMillis());
        calendar.setTime(l);
//        if(calendar != null)
//        {
            int i1;
            if((i1 = calendar.get(10)) < 10)
                stringbuffer.append('0');
            stringbuffer.append(i1);
            stringbuffer.append(':');
            if((i1 = calendar.get(12)) < 10)
                stringbuffer.append('0');
            stringbuffer.append(i1);
            stringbuffer.append(':');
            if((i1 = calendar.get(13)) < 10)
                stringbuffer.append('0');
            stringbuffer.append(i1);
//        } else
//        {
//            stringbuffer.append("null");
//        }
        stringbuffer.append(':');
        stringbuffer.append(' ');
        stringbuffer.append(s);
        if(a(1))
            System.out.println(stringbuffer.toString());
        if(a > 0 && b.a >= a)
            b.b(0);
        b.e(stringbuffer.toString());
    }

    public static InputStream d(String s)
    {
        if(s == null)
            return null;
        InputStream inputstream;
        if((inputstream = aq.a().d(s)) != null)
            return inputstream;
        else
            return n.getResourceAsStream(s);
    }

    public static int c(int i1)
    {
        int j1 = 1;
        if(i1 < 0)
        {
            i1 = -i1;
            j1 = -1;
        }
        if(i1 > 360)
            i1 %= 360;
        if(i1 > 180)
        {
            i1 -= 180;
            j1 = -j1;
        }
        if(i1 > 90)
            i1 = 180 - i1;
        return j1 * i[i1];
    }

    public static int d(int i1)
    {
        return c(i1 + 90);
    }

    public static int e(String s)
    {
        try {
            return Integer.parseInt(s);
        } catch (NumberFormatException e1) {
            return 0;
        }
    }

    public static cc a(String s, String s1) {
        cc cc1;
        int i1;
        cc1 = new cc();
        i1 = s.length();
        for (int j1 = 0; j1 < i1;) {
            int k1 = s.indexOf(s1, j1);
            if ((k1) == -1) {
                cc1.e(((Object) (s.substring(j1))));
                break;
            } else {
                cc1.e(((Object) (s.substring(j1, k1))));
                j1 = k1 + s1.length();
            }
        }
        return cc1;
    }

    public static void a(String s, String s1, String s2, bs bs1)
    {
        if(b())
        {
            q q1 = q.a(new q[] {
                q.a("type", q.c("sms")), q.a("widget", q.c(s)), q.a("number", q.c(s1))
            });
            aj aj1;
            if((aj1 = (aj)bt.d().a.b("prompt", ((Object) (q1)))) != null)
            {
                bq bq1 = c(s1, s2);
                p p1 = new p();
                bq1.k = ((Object) (new Object[] {
                    aj1.c, bs1, aj1
                }));
                try
                {
                    y y1 = (y)Class.forName("ak").newInstance();
                    aj1.c = (k)y1;
                    y1.a(bq1, p1);
                }
                catch(Throwable throwable)
                {
                    c("Message sending failed2: " + throwable);
                }
                bh.b().a(aj1, true);
            }
            return;
        } else
        {
            boolean flag = d(s1, s2);
            a(bs1, flag);
            return;
        }
    }

    public static void a(bs bs1, boolean flag) {
        bb bb1;
        if (bs1 != null) {
            bb1 = bb.b();
            try {
                bb1.a(1, flag);
                bb1.a(bs1);
                bb1.c();
            } catch (Exception exception) {
                bb1.c();
            }
        }
    }

    private static bq c(String s, String s1)
    {
        q q1;
        (q1 = q.h()).b("number", s);
        q1.b("message", s1);
        bq bq1;
        (bq1 = new bq()).i = q1;
        return bq1;
    }

    private static boolean d(String s, String s1)
    {
        bq bq1 = c(s, s1);
        p p1;
        p1 = new p();
        try{
        y y1 = (y)Class.forName("ak").newInstance();
        (y1).a(bq1, p1);
        q q1;
        if((q1 = p1.c) != null)
            return q1.d();
        }catch(Throwable throwable){
        c("Message sending failed2: " + throwable);
        }
        return false;
    }

    public static String f(String s)
    {
        String s1;
        String s2;
        String s3;
        if(a(26) && (s1 = h(s)) != null && (s2 = (String)o.get(((Object) (s1)))) != null)
            return s3 = e(s, s2);
        else
            return s;
    }

    public static void b(String s, String s1)
    {
        if(!a(26))
            return;
        if(s1 == null || s1.length() == 0)
            return;
        String s2;
        if((s2 = h(s)) != null && !o.containsKey(((Object) (s2))))
            o.put(((Object) (s2)), ((Object) (s1)));
    }

    private static String e(String s, String s1)
    {
        int i1;
        if((i1 = s.indexOf("//")) > 0)
        {
            int j1;
            if((j1 = s.indexOf("/", i1 + 2)) == -1)
                j1 = s.length();
            int k1;
            if((k1 = s.indexOf(":", i1 + 2)) > 0 && k1 < j1)
                j1 = k1;
            return s.substring(0, i1 + 2) + s1 + s.substring(j1);
        } else
        {
            return null;
        }
    }

    private static String h(String s)
    {
        int i1;
        if((i1 = s.indexOf("//")) > 0)
        {
            int j1;
            if((j1 = s.indexOf("/", i1 + 2)) == -1)
                j1 = s.length();
            int k1;
            if((k1 = s.indexOf(":", i1 + 2)) > 0 && k1 < j1)
                j1 = k1;
            return s.substring(i1 + 2, j1);
        } else
        {
            return null;
        }
    }

    public static as a(aw aw1, String s, int i1, int j1, String s1)
    {
        boolean flag = d.a.b();
        String s2 = (flag) ? "/loading2.png" : "loading1.png";
        as as1;
        (as1 = new as(bh.a("default"), bh.c().b(s2))).J = ((Object) (s));
        if(flag)
        {
            q q1 = q.a(new q[] {
                q.a("url", q.c(s)), q.a("boundx", q.c(i1)), q.a("boundy", q.c(j1)), q.a("format", q.c(s1))
            });
            q q2 = q.a(new q[] {
                q.a("id", q.c(aw1.e)), q.a("typ", "image"), q.a("ver", q.c(1)), q.a("act", "geturl"), q.a("arg", q1)
            });
            bq.a("dabo/call", q2, aw1.e, ((Object) (as1)), ((bx) (new cf(as1))), true);
        }
        return as1;
    }

    private static boolean b()
    {
        String s;
        return (s = aq.a().b("MIDlet-Certificate-1-1")) != null && s.length() > 0;
    }

    public static long a()
    {
        System.gc();
        Runtime runtime;
        long l1 = (runtime = Runtime.getRuntime()).totalMemory();
        long l2 = runtime.freeMemory();
        long l3;
        return l3 = l1 - l2;
    }
}
